package com.slaffka.dao;

import com.slaffka.model.Theme;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * _User: v.tsapaev
 * Date: 18.02.12
 * Time: 22:59
 * To change this template use File | Settings | File Templates.
 */
@Repository(value = "themeDAO")
public class ThemeDAOImpl implements ThemeDAO {

   // @Resource(name="sessionFactory")
    @Autowired
    private SessionFactory sessionFactory;

    @Override
    public List<Theme> getThemeList() {
        return (List<Theme>) sessionFactory.getCurrentSession().createQuery("from Theme").list();
    }
}
